#!ipxe

goto ${menu} ||

:live_menu
set os Grml
set os_arch ${arch}
iseq ${os_arch} x86_64 && set os_arch amd64 ||
iseq ${os_arch} arm64 && set os_arch arm64 ||
menu ${os} - Current Arch [ ${arch} ]
item --gap ${os} Versions
{% for key, value in endpoints.items() | sort %}
{% if value.os == "grml" %}
iseq ${os_arch} {{ value.arch }} && item {{ value.version }}-{{ value.flavor }}-{{ value.arch }} ${space} ${os} {{ value.version }} {{ value.flavor }} - {{ value.arch }} ||
{% endif %}
{% endfor %}
choose live_version || goto live_exit
goto ${live_version}

{% for key, value in endpoints.items() | sort %}
{% if value.os == "grml" %}
:{{ value.version }}-{{ value.flavor }}-{{ value.arch }}
set squash_url ${live_endpoint}{{ value.path }}filesystem.squashfs
set kernel_url ${live_endpoint}{{ value.path }}
goto boot

{% endif %}
{% endfor %}

:boot
imgfree
kernel ${kernel_url}vmlinuz boot=live fetch=${squash_url} {{ kernel_params }}
initrd ${kernel_url}initrd
boot

:live_exit
clear menu
exit 0
